import request from '@/utils/request'
import qs from 'qs'

export function addPrescription(data) {
  return request({
    url: '/prescriptionBase/save',
    method: 'post',
    data
  })
}

export function addPrescriptionMedicine(data) { // 加药
  return request({
    url: '/prescriptionMedicine/save',
    method: 'post',
    data
  })
}

export function updatePresciption(data) { // 更新药方
  return request({
    url: '/prescriptionBase/updateById',
    method: 'post',
    data
  })
}


export function deletePrescriptionMedicine(data) { // 删除药方的药
  return request({
    url: '/prescriptionMedicine/deleteById',
    method: 'post',
    data: qs.stringify(data),
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8'
    }
  })
}

export function getPrescriptionInfoById(data) { // 查药方详细
  return request({
    url: '/prescriptionBase/queryInfoById',
    method: 'get',
    params: data
  })
}

export function getPrescription(data) { // 查药方list
  return request({
    url: '/prescriptionBase/queryList',
    method: 'get',
    params: data
  })
}

export function deletePresciption(data) { // 删除药方
  return request({
    url: '/prescriptionBase/deleteById',
    method: 'post',
    data: qs.stringify(data),
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8'
    }
  })
}

